//
//  PayViewController.m
//  pingtaiceshi
//
//  Created by longziyuan on 14-8-27.
//
//

#import "PayViewController.h"
#import "GlobalVar.h"
#import "DisPayContentViewController.h"

#import "PayContentViewController.h"
@interface PayViewController ()

@end

@implementation PayViewController
@synthesize List_Array;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}
-(void)dealloc
{
    self.List_Array=nil;
    Lab = nil;
    [super dealloc];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    self.view.backgroundColor=[UIColor whiteColor];
    self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
    
    

    
    self.title = @"账户充值";
    
    
    dataTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, IPHONE_W, IPHONE_H-49) style:UITableViewStyleGrouped];
	dataTableView.dataSource = self;

    dataTableView.delegate = self;
    
    
   
    
    
    
	[self.view addSubview:dataTableView];
    
    
    self.List_Array = [[[NSMutableArray alloc] initWithCapacity:1]autorelease];
    [self.List_Array addObject:[NSArray arrayWithObjects:@"ka_icon_14",@"移动充值卡", nil]];
    [self.List_Array addObject:[NSArray arrayWithObjects:@"ka_icon_15",@"联通充值卡", nil]];
    [self.List_Array addObject:[NSArray arrayWithObjects:@"yaloeka",[NSString stringWithFormat:@"%@充值卡",SOFT_NAME], nil]];
    [self.List_Array addObject:[NSArray arrayWithObjects:@"ka_icon_3",@"电信充值卡", nil]];
    [self.List_Array addObject:[NSArray arrayWithObjects:@"kashuoming",@"充值卡说明", nil]];

    
    
    
    
    
    
    
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 40;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 5;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *KCell = @"Kcell";
    UITableViewCell *Cell = [tableView dequeueReusableCellWithIdentifier:KCell];
    
    if(Cell == nil){
        Cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:KCell]autorelease];
        Cell.selectionStyle = UITableViewCellSelectionStyleNone;
        Cell.accessoryType = UITableViewCellAccessoryNone;
        
        UIImageView *Icon = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 24, 24)];
        [Icon setTag:8000];
        [Cell.contentView addSubview:Icon];
        [Icon release];
        
        Lab = [[[UILabel alloc] initWithFrame:CGRectMake(50, 10, 200, 20)]autorelease];
        [Lab setBackgroundColor:[UIColor clearColor]];
        [Lab setFont:[UIFont systemFontOfSize:16]];
        [Lab setTag:9000];
        [Cell.contentView addSubview:Lab];
        
        
    }
    if(List_Array){
        if(indexPath.row < [List_Array count]){
            NSString *Value = [NSString stringWithFormat:@"%@",[[List_Array objectAtIndex:indexPath.row] objectAtIndex:1]];
            [(UILabel *)[Cell.contentView viewWithTag:9000] setText:Value];
            
            NSString *Value1 = [NSString stringWithFormat:@"%@",[[List_Array objectAtIndex:indexPath.row] objectAtIndex:0]];
            [(UIImageView *)[Cell.contentView viewWithTag:8000] setImage:[UIImage imageNamed:Value1]];
        }
    }
    
    
    
    
    
        
    return Cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.row==2) {
        DisPayContentViewController* sileContent=[[DisPayContentViewController alloc]init];
        [self.navigationController pushViewController:sileContent animated:YES];
        [sileContent release];
        sileContent=nil;
    }else
    {
        PayContentViewController *Siliwen_ChongZhi = [[PayContentViewController alloc] init];
        Siliwen_ChongZhi.ChongZhi_Type = indexPath.row;
        [self.navigationController pushViewController:Siliwen_ChongZhi animated:YES];
        [Siliwen_ChongZhi release];
        Siliwen_ChongZhi = nil;
    }
    
    
}




- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
